package com.bmldyq.family.controller;

import com.bmldyq.family.common.vo.AvailableResult;
import com.bmldyq.family.model.SysParam;
import com.bmldyq.family.service.SysService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/base/codes")
@Slf4j
public class CodeManagerController {


    @Autowired
    private SysService sysService;

    @ResponseBody
    @RequestMapping(value = "/getAll",method = RequestMethod.GET)
    public AvailableResult<SysParam> queryCodes(){
        log.info("CodeManagerController.queryCodes begin....");
        List<SysParam>  list = sysService.querySysParamForList();
        AvailableResult<SysParam> availableResult = new AvailableResult<>();
        availableResult.setCode(HttpStatus.OK);
        availableResult.setMsg("request is ok ! ");
        availableResult.setListData(list);
        log.info("CodeManagerController.queryCodes end...availableResult={}",availableResult);
        return availableResult;
    }
    @ResponseBody
    @RequestMapping(value = "/get",method = RequestMethod.GET)
    public AvailableResult<SysParam> getSysParam(){
        log.info("get param...");
        SysParam param = new SysParam();
        param.setParamId("3001");
        param.setParamName("serialSn");
        param.setParamDesc("流水号");
        param.setCreateTime("202020521121212");
        param.setParamValue("00001");
        param.setUpdateTime("202020521121212");
        AvailableResult<SysParam> ava = new AvailableResult<>();
        ava.setKdata(param);
        ava.setCode(HttpStatus.OK);
        ava.setMsg("ok");
        return ava;
    }



}
